package com.xzavier.yunlian_interview.controller;

import com.xzavier.yunlian_interview.entity.Project;
import com.xzavier.yunlian_interview.service.ProjectService;
import com.xzavier.yunlian_interview.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("interview/project")
public class ProjectController {
    @Autowired
    private ProjectService projectService;

    @GetMapping("getAll")
    public JsonResult<List<Project>> getProjects() {
        List<Project> projects = projectService.getProjects();
        return new JsonResult<>(200, projects);
    }
}
